package by.siarhei.java.tij.reusing.exercises.ex24;

import by.siarhei.java.tij.reusing.Beetle;

/**
 * @author Siarhei Shchahratsou <s.siarhei@gmail.com>
 * @since 23.03.2014
 */
public class Scarabey extends Beetle {
    public static String STATIC_STRING = staticString();
    public String nonStaticString = nonStaticString();
    public final int n, m;
    public static final int p;

    {
        this.n = 5;
        System.out.println("init Scarabey.n=" + n);
    }

    static {
        p = 100;
        System.out.println("init Scarabey.p="+p);
    }

    public Scarabey() {
        this.m = 50;
        System.out.println("init Scarabey.m="+m);
    }

    public static void main(String[] args) {
        System.out.println("Create Scarabey");
        //new Beetle();
        new Scarabey();
    }

    static {
        STATIC_STRING = "another static string";
        System.out.println("re-init Scarabey.STATIC_STRING="+STATIC_STRING);
    }

    private static String staticString() {
        System.out.println("get static string");
        return "a static string";
    }

    private String nonStaticString() {
        System.out.println("get non-static string");
        return "non static string";
    }

}
